import colorMap from '@/assets/data/arco-palette.json'

export default function (name: string) {
  const colorList = colorMap.light[name] || colorMap.light['arcoblue']
  const el = document.body as HTMLElement
  for (let i = 0; i <= 9; i++) {
    const _color = colorList[i]
    const tempColors = _color.split('#')[1]
    const r = parseInt('0x' + tempColors.slice(0, 2))
    const g = parseInt('0x' + tempColors.slice(2, 4))
    const b = parseInt('0x' + tempColors.slice(4, 6))
    el.style.setProperty('--primary-' + (i + 1), `${r}, ${g}, ${b}`)
  }
}
